<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

    <head>
        <title>Oauth Login</title>
        {include file="public/header" /}
        <!--页面加上边的--->
        <style>
        .radius {
            -webkit-border-radius: 5000px;
            -moz-border-radius: 5000px;
            border-radius: 5000px;
        }
        </style>
        <form id="loginbox" action="" method="POST" onsubmit="return login();" {if condition="!empty($user)"}style="display:none;"{/if}>
            <div class="weui-cells__title">您正在授权登录 <font color="orangered">{$app.app_name}</font></div>
            <div class="weui-cells weui-cells__form">
                <div class="weui-cell">
                    <div class="weui-cell__bd">
                        <input class="weui-input" type="text" placeholder="Account" id="account" name="account">
                    </div>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__bd">
                        <input class="weui-input" type="password" placeholder="Password" id="password" name="password">
                    </div>
                </div>
                <div class="weui-cell">
                    <input class="weui-btn weui-btn_primary" type="submit" value="授权">
                </div>
            </div>
        </form>
        <script>
            var loginTimer;
        </script>
        <div id="msg" class="weui-msg" {if condition="empty($user)"}style="display:none;"{/if}>
            <div class="weui-msg__icon-area"><i class="weui-icon-success weui-icon_msg"></i></div>
            <div class="weui-msg__text-area">
                <p class="weui-msg__desc">正在自动登录中...</p>
            </div>
            <script>
                {if condition="!empty($user)"}
                loginTimer = setTimeout(function(){
                    location.href='{$url}';
                },30000);
                {/if}
            </script>
            <div class="weui-msg__extra-area">
                <a href="javascript:show();">切换帐号</a>
            </div>
        </div>
        <!--页面加下边的--->
        {include file="public/footer" /}
        <script>
            function show(){
                clearTimeout(loginTimer);
                $("#loginbox").fadeIn();
                $("#msg").hide();
            }
            function login(){
                var account = $("#account").val();
                var password = $("#password").val();
                if(Trim(account).length==0){
                    alert("Input your account please!");return false;
                }
                if(Trim(password).length==0){
                    alert("Input your password please!");return false;
                }
                return true;
            }
            function Trim(str)
            {
                str = str.replace(/(^\s*)|(\s*$)/g, "");
                return str;
            }
        </script>
        </body>

</html>